﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Work2
{
    class Program
    {
        static int Min(int[] num)
        {
            int min = int.MaxValue;
            foreach(int x in num)
            {
                if (x < min)
                    min = x;
            }
            return min;
        }

        static int Max(int[] num)
        {
            int max = int.MinValue;
            foreach (int x in num)
            {
                if (x > max)
                    max = x;
            }
            return max;
        }

        static int Sum(int[] num)
        {
            int sum = 0;
            foreach (int x in num)
                sum += x;
            return sum;
        }

        static double Average(int [] num)
        {
            double average = 0;
            int n = 0;
            foreach (int x in num)
                n++;
            average = (double)Sum(num) / n;
            return average;
        }
        static void Main(string[] args)
        {
            int[] num = new int[] { 1, 2, 4, 3, 0, -1, 34, 545, 2, 34 };
            int max = Max(num);
            int min = Min(num);
            int sum = Sum(num);
            double average = Average(num);
            Console.WriteLine($"数组的最大值为{max} 最小值为{min} 平均值为{average} 元素和为{sum}");

        }
    }
}
